<div id = "filterForm" %>
	<%= form_for filter, :url => { :controller => "suppliers", :action => "add_filter" }  do |f| %>
		<%= f.hidden_field :supplier_id, :value => current_supplier.id %>
    	<%= f.select :car_brand_id, options_from_collection_for_select(CarBrand.all(:order => :name), 'id', 'name', :selected => filter.car_brand_id), :include_blank => '< Марка >' %>
    
    	<div id = "carModels">
			<%= render :partial => 'car_models', :locals => { :car_model_id => filter.car_model_id, :car_models => CarModel.where(:car_brand_id => filter.car_brand_id).order(:name) } %>
			
		</div>
	
		<%= f.select :start_year, options_for_select((1960..2011).to_a.reverse, :selected => filter.start_year), :include_blank => '< Начална година >'  %>
		<%= f.select :end_year, options_for_select((1960..2011).to_a.reverse, :selected => filter.end_year), :include_blank => '< Крайна година >'  %>
		<%= f.select :parts_group_id, options_from_collection_for_select(PartsGroup.all, 'id', 'name', :selected => filter.parts_group_id), :include_blank => '< Група части >'  %>
		<%= f.select :engine_type_id, options_from_collection_for_select(EngineType.all, 'id', 'name', :selected => filter.engine_type_id), :include_blank => '< Mодел >'  %>
		<%= f.select :gearbox_type_id, options_from_collection_for_select(GearboxType.all, 'id', 'name', :selected => filter.gearbox_type_id), :include_blank => '< Скоростна кутия >'  %>
		<%= f.submit %>
	<% end %>
</div>

